let oldpassword = document.getElementById("oldpassword");
oldpassword={"status":"false"}
let newpassword = document.getElementById("newpassword");
newpassword={"status":"false"}
let rnewpassword = document.getElementById("rnewpassword");
rnewpassword={"status":"false"}
function oldpassword_check() {
    $.ajax({
        url:"../pwdmodify/oldpassword",
        data:{"oldpassword":$("#oldpassword").val()},
        type:"GET",
        success:function (data){
            if (data=="true"){
                $("#oldPassword_font").attr("hidden","true")
                oldpassword.status="true";
            }else{
                $("#oldPassword_font").removeAttr("hidden")
                oldpassword.status="false";
            }
        }
    })
}
function newpassword_check() {
    $.ajax({
        url:"../pwdmodify/newpassword",
        data:{"newpassword":$("#newpassword").val()},
        type:"GET",
        success:function (data){
            if (data=="true"){
                $("#newPassword_font").attr("hidden","true")
                newpassword.status="true";
            }else{
                $("#newPassword_font").removeAttr("hidden")
                newpassword.status="false";
            }
        }
    })
}
function rnewpassword_check() {
    $.ajax({
        url:"../pwdmodify/rnewpassword",
        data:{"rnewpassword":$("#rnewpassword").val(),"newpassword":$("#newpassword").val()},
        type:"GET",
        success:function (data){
            if (data=="true"){
                $("#rnewpassword_font").attr("hidden","true")
                rnewpassword.status="true";
            }else{
                $("#rnewpassword_font").removeAttr("hidden")
                rnewpassword.status="false";
            }
        }
    })
}
function submit_change() {
    console.log(oldpassword.status)
    console.log(rnewpassword.status)
    console.log(newpassword.status)
    if (oldpassword.status=="true"&&newpassword.status=="true"&&rnewpassword.status=="true"){
        if (confirm("Are you sure to change your password?")){
            return true;
        }else {
            return false;
        }
    }
    else {
        confirm("zz")
        return false;
    }
}